package com.lzy.system.organization.controller;

import com.lzy.conf.JSONResult;
import com.lzy.system.organization.service.ISysLoginLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 登录日志 前端控制器
 * </p>
 *
 * @author lcc
 * @since 2023-11-14
 */
@RestController
@RequestMapping("/organization/sysLoginLog")
@Api(tags = "登录日志")
@Slf4j
public class SysLoginLogController {
    private ISysLoginLogService iSysLoginLogService;

    @Autowired
    public SysLoginLogController(ISysLoginLogService iSysLoginLogService) {
        this.iSysLoginLogService = iSysLoginLogService;
    }

    @ApiOperation("查询登录日志列表")
    @RequestMapping(value = "getList", method = RequestMethod.POST)
    public JSONResult getList(
            @ApiParam("账号") @RequestParam(name = "userId", required = false, defaultValue = "") String userId,
            @ApiParam("姓名") @RequestParam(name = "userName", required = false, defaultValue = "") String userName,
            @ApiParam("每页显示行数") @RequestParam(name = "limit", required = true, defaultValue = "5") int limit,
            @ApiParam("当前页数") @RequestParam(name = "page", required = true, defaultValue = "1") int page
    ) throws Exception {
        return JSONResult.ok(iSysLoginLogService.getList(userId,userName,limit, page));
    }
}
